$(function () {
    let addCart = $('#add_cart');
    let addCartX = addCart.offset().top;
    let addCartY = addCart.offset().left;

    let showCountX = $('#show_count').offset().top;
    let showCountY = $('#show_count').offset().left;
    let cartCount = 0;
    var qu = $("[class=\"num_show fl\"]").val();
    var name = $("h3").html();
    var username = $("[class=\"login_info fl\"]").val();
    $(".add_jump").css({'left': addCartY + 80, 'top': addCartX + 10, 'display': 'block'})
    addCart.click(function () {
        $.get("shopping/add",
            {
                "quantity": qu,
                "fname": name,
                "nickname":username
            },
            function (b
            ) {
                $(".add_jump").stop().animate({
                        'left': showCountY + 7,
                        'top': showCountX + 7
                    },
                    "fast", function () {
                        $(".add_jump").fadeOut('fast', function () {
                            $('#show_count').html(++cartCount);
                            $(".add_jump").css({'left': addCartY + 80, 'top': addCartX + 10, 'display': 'block'})
                        });
                    });
            })
    })

});
